Optimal. Leaf size=132 \[ -\frac {3 a^3 \tan (e+f x) \left (c (d \tan (e+f x))^p\right )^n}{f (1+n p)}+\frac {4 a^3 \, _2F_1(1,1+n p;2+n p;i \tan (e+f x)) \tan (e+f x) \left (c (d \tan (e+f x))^p\right )^n}{f (1+n p)}-\frac {i a^3 \tan ^2(e+f x) \left (c (d \tan (e+f x))^p\right )^n}{f (2+n p)} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.17, antiderivative size = 132, normalized size of antiderivative = 1.00, number of steps
used = 8, number of rules used = 5, integrand size = 30, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.167, Rules used = {1600, 1970, 90,
66, 45} \begin {gather*} \frac {4 a^3 \tan (e+f x) \, _2F_1(1,n p+1;n p+2;i \tan (e+f x)) \left (c (d \tan (e+f x))^p\right )^n}{f (n p+1)}-\frac {i a^3 \tan ^2(e+f x) \left (c (d \tan (e+f x))^p\right )^n}{f (n p+2)}-\frac {3 a^3 \tan (e+f x) \left (c (d \tan (e+f x))^p\right )^n}{f (n p+1)} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 45
Rule 66
Rule 90
Rule 1600
Rule 1970
Rubi steps
\begin {align*} \int \left (c (d \tan (e+f x))^p\right )^n (a+i a \tan (e+f x))^3 \, dx &=\frac {\text {Subst}\left (\int \frac {\left (c (d x)^p\right )^n (a+i a x)^3}{1+x^2} \, dx,x,\tan (e+f x)\right )}{f}\\ &=\frac {\text {Subst}\left (\int \frac {\left (c (d x)^p\right )^n (a+i a x)^2}{\frac {1}{a}-\frac {i x}{a}} \, dx,x,\tan (e+f x)\right )}{f}\\ &=\frac {\left ((d \tan (e+f x))^{-n p} \left (c (d \tan (e+f x))^p\right )^n\right ) \text {Subst}\left (\int \frac {(d x)^{n p} (a+i a x)^2}{\frac {1}{a}-\frac {i x}{a}} \, dx,x,\tan (e+f x)\right )}{f}\\ &=\frac {\left ((d \tan (e+f x))^{-n p} \left (c (d \tan (e+f x))^p\right )^n\right ) \text {Subst}\left (\int \left (-2 a^3 (d x)^{n p}+\frac {4 a^2 (d x)^{n p}}{\frac {1}{a}-\frac {i x}{a}}-a^2 (d x)^{n p} (a+i a x)\right ) \, dx,x,\tan (e+f x)\right )}{f}\\ &=-\frac {2 a^3 \tan (e+f x) \left (c (d \tan (e+f x))^p\right )^n}{f (1+n p)}-\frac {\left (a^2 (d \tan (e+f x))^{-n p} \left (c (d \tan (e+f x))^p\right )^n\right ) \text {Subst}\left (\int (d x)^{n p} (a+i a x) \, dx,x,\tan (e+f x)\right )}{f}+\frac {\left (4 a^2 (d \tan (e+f x))^{-n p} \left (c (d \tan (e+f x))^p\right )^n\right ) \text {Subst}\left (\int \frac {(d x)^{n p}}{\frac {1}{a}-\frac {i x}{a}} \, dx,x,\tan (e+f x)\right )}{f}\\ &=-\frac {2 a^3 \tan (e+f x) \left (c (d \tan (e+f x))^p\right )^n}{f (1+n p)}+\frac {4 a^3 \, _2F_1(1,1+n p;2+n p;i \tan (e+f x)) \tan (e+f x) \left (c (d \tan (e+f x))^p\right )^n}{f (1+n p)}-\frac {\left (a^2 (d \tan (e+f x))^{-n p} \left (c (d \tan (e+f x))^p\right )^n\right ) \text {Subst}\left (\int \left (a (d x)^{n p}+\frac {i a (d x)^{1+n p}}{d}\right ) \, dx,x,\tan (e+f x)\right )}{f}\\ &=-\frac {3 a^3 \tan (e+f x) \left (c (d \tan (e+f x))^p\right )^n}{f (1+n p)}+\frac {4 a^3 \, _2F_1(1,1+n p;2+n p;i \tan (e+f x)) \tan (e+f x) \left (c (d \tan (e+f x))^p\right )^n}{f (1+n p)}-\frac {i a^3 \tan ^2(e+f x) \left (c (d \tan (e+f x))^p\right )^n}{f (2+n p)}\\ \end {align*}
________________________________________________________________________________________
Mathematica [B] Both result and optimal contain complex but leaf count is larger than twice
the leaf count of optimal. \(981\) vs. \(2(132)=264\).
time = 8.80, size = 981, normalized size = 7.43 \begin {gather*} \frac {\cos ^3(e+f x) \left (\frac {\sec ^2(e+f x) (-i \cos (3 e)-\sin (3 e))}{2+n p}+\frac {(-3-2 n p+\cos (2 e)) \sec ^2(e) \left (-\frac {1}{2} i \cos (3 e)-\frac {1}{2} \sin (3 e)\right )}{(1+n p) (2+n p)}+\frac {(-\cos (e-f x)+\cos (e+f x)) \sec ^2(e) \sec (e+f x) \left (-\frac {1}{2} i \cos (3 e)-\frac {1}{2} \sin (3 e)\right )}{1+n p}\right ) \left (c (d \tan (e+f x))^p\right )^n (a+i a \tan (e+f x))^3}{f (\cos (f x)+i \sin (f x))^3}+\frac {\cos ^3(e+f x) \left (\frac {\sec ^2(e) (-1+\cos (2 e)+3 i \sin (2 e)) \left (\frac {1}{2} i \cos (3 e)+\frac {1}{2} \sin (3 e)\right )}{1+n p}+\frac {\sec ^2(e) \sec (e+f x) \left (\frac {1}{2} i \cos (3 e)+\frac {1}{2} \sin (3 e)\right ) (-\cos (e-f x)+\cos (e+f x)-3 i \sin (e-f x)+3 i \sin (e+f x))}{1+n p}\right ) \left (c (d \tan (e+f x))^p\right )^n (a+i a \tan (e+f x))^3}{f (\cos (f x)+i \sin (f x))^3}+\frac {i 2^{2-n p} \left (-\frac {i \left (-1+e^{2 i (e+f x)}\right )}{1+e^{2 i (e+f x)}}\right )^{n p} \cos ^3(e+f x) \left (2^{n p} \, _2F_1\left (1,n p;1+n p;-\frac {-1+e^{2 i (e+f x)}}{1+e^{2 i (e+f x)}}\right )-\left (1+e^{2 i (e+f x)}\right )^{n p} \, _2F_1\left (n p,n p;1+n p;\frac {1}{2} \left (1-e^{2 i (e+f x)}\right )\right )\right ) \tan ^{-n p}(e+f x) \left (c (d \tan (e+f x))^p\right )^n (a+i a \tan (e+f x))^3}{\left (e^{i e}+e^{3 i e}\right ) f n p (\cos (f x)+i \sin (f x))^3}-\frac {4 i e^{-3 i e} \left (-1+e^{2 i (e+f x)}\right )^{n p} \left (-\frac {i \left (-1+e^{2 i (e+f x)}\right )}{1+e^{2 i (e+f x)}}\right )^{n p} \left (\frac {-1+e^{2 i (e+f x)}}{1+e^{2 i (e+f x)}}\right )^{-n p} \cos ^3(e+f x) \left (-\frac {\left (1+e^{2 i (e+f x)}\right )^{-n p} \, _2F_1\left (1,n p;1+n p;\frac {1-e^{2 i (e+f x)}}{1+e^{2 i (e+f x)}}\right )}{n p}-\frac {\left (1+e^{2 i e}\right ) \left (-1+e^{2 i (e+f x)}\right ) \left (1+e^{2 i (e+f x)}\right )^{-1-n p} \, _2F_1\left (1,1+n p;2+n p;\frac {1-e^{2 i (e+f x)}}{1+e^{2 i (e+f x)}}\right )}{1+n p}+\frac {2^{-n p} \, _2F_1\left (n p,n p;1+n p;\frac {1}{2} \left (1-e^{2 i (e+f x)}\right )\right )}{n p}\right ) \tan ^{-n p}(e+f x) \left (c (d \tan (e+f x))^p\right )^n (a+i a \tan (e+f x))^3}{\left (1+e^{2 i e}\right ) f (\cos (f x)+i \sin (f x))^3} \end {gather*}
Warning: Unable to verify antiderivative.
[In]
[Out]
________________________________________________________________________________________
Maple [F]
time = 0.17, size = 0, normalized size = 0.00 \[\int \left (c \left (d \tan \left (f x +e \right )\right )^{p}\right )^{n} \left (a +i a \tan \left (f x +e \right )\right )^{3}\, dx\]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Failed to integrate} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {could not integrate} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} - i a^{3} \left (\int i \left (c \left (d \tan {\left (e + f x \right )}\right )^{p}\right )^{n}\, dx + \int \left (- 3 \left (c \left (d \tan {\left (e + f x \right )}\right )^{p}\right )^{n} \tan {\left (e + f x \right )}\right )\, dx + \int \left (c \left (d \tan {\left (e + f x \right )}\right )^{p}\right )^{n} \tan ^{3}{\left (e + f x \right )}\, dx + \int \left (- 3 i \left (c \left (d \tan {\left (e + f x \right )}\right )^{p}\right )^{n} \tan ^{2}{\left (e + f x \right )}\right )\, dx\right ) \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {could not integrate} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [F]
time = 0.00, size = -1, normalized size = -0.01 \begin {gather*} \int {\left (c\,{\left (d\,\mathrm {tan}\left (e+f\,x\right )\right )}^p\right )}^n\,{\left (a+a\,\mathrm {tan}\left (e+f\,x\right )\,1{}\mathrm {i}\right )}^3 \,d x \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________